<!--车间生产压力统计-->
<div style="height:15px;"></div>
<table class="layui-table" id="tb_cjyl">
	<thead>
	<tr>
		<th class="title">&nbsp;</th>
		<th colspan="2" class="title">本月出货情况</th>
		<th colspan="2" class="title">上月出货情况</th>
		<th colspan="1" class="title">近21日出货情况</th>
        <th colspan="1" class="title">采购</th>
        <th colspan="1" class="title">裁剪</th>
		<th colspan="2" class="title">车间生产压力</th>
	</tr>
	<tr>
		<th class="title">组别</th>
		<th class="title">件数</th>
		<th class="title">加工费</th>
		<th class="title">件数</th>
		<th class="title">加工费</th>
		<th class="title">平均每日加工费</th>
        <th class="title">加工费</th>
        <th class="title">加工费</th>
		<th class="title">总件数</th>
		<th class="title">总加工费</th>
	</tr>
	</thead>
	<tbody id="cjyl_items">
	<tr>
		<td class="title"></td>
		<td class="value">0</td>
		<td class="value">0</td>
		<td class="value">0</td>
		<td class="value">0</td>
		<td class="value">0</td>
		<td class="value">0</td>
		<td class="value">0</td>
		<td class="value">0</td>
		<td class="value">0</td>
	</tr>
	</tbody>
</table>

<script>
layui.use(['jquery', 'layer'], function() {
	var $ = layui.jquery;
	var layer = layui.layer;
		
	//车间生产压力统计
	window.getCjyl = function() {
		$.ajax({
			type: "POST",
			url: "?c=daily&m=index",
			data: "_ajax=1&fun=_getCjyl&factory_id="+factoryId+"&from="+from,
			dataType: "json",
			success: function(res){
				if(res.code == 1){
					var d = res.data;
					var list = d.list;
					var html = '';
					$.each(list, function(index, rows) {
						var stat = rows['stat'];	
						$.each(stat, function(index, value) {
							html += '<tr>';
							html += '<td class="title">' + value['name'] + '</td>'
							html += '<td class="value">' + value['month_jianshu'] + '</td>';
							html += '<td class="value">' + value['month_cost'] + '</td>';
							html += '<td class="value">' + value['last_month_jianshu'] + '</td>';
							html += '<td class="value">' + value['last_month_cost'] + '</td>';
							html += '<td class="value">' + value['avg_cost'] + '</td>';
							html += '<td class="value">' + value['caigou_cost'] + '</td>';
							html += '<td class="value">' + value['caijian_cost'] + '</td>';
							//html += '<td class="value">' + value['money_wkh'] + '</td>';
							//html += '<td class="value">' + value['money_jxz'] + '</td>';
							html += '<td class="value">' + value['jianshu_total'] + '</td>';
							html += '<td class="value">' + value['money_total'] + '</td>';
							html += '</tr>';
						});
					});
	
					$("#cjyl_items").html(html);
				} else layer.msg(res.msg, {icon: 2,anim: 6});
			}
		});
	}

	setTimeout("getCjyl()", 1000);		// 车间生产压力统计
	setInterval("getCjyl()", 1800000); 	// 30分钟
});
</script>